package com.gxuwz.easyschool.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.gxuwz.easyschool.BalanceQueryActivity;
import com.gxuwz.easyschool.CardLossActivity;
import com.gxuwz.easyschool.CardTopUpActivity;
import com.gxuwz.easyschool.CardUnlockActivity;
import com.gxuwz.easyschool.NewsBulletinActivity;
import com.gxuwz.easyschool.PaymentCodeActivity;
import com.gxuwz.easyschool.R;
import com.gxuwz.easyschool.SchoolIntroductionActivity;
import com.gxuwz.easyschool.TradeQueryActivity;

public class NavHomeFragment extends Fragment {

    private ImageView qrcode,card_topup,balance;
    private ImageView qrcode_item,school_introduction_item,news_bulletin_item,card_topup_item,
            trade_query_item,card_loss_item,card_unlock_item;

    public NavHomeFragment getInstance(){
        NavHomeFragment navHomeFragment = new NavHomeFragment();
        return navHomeFragment;
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.nav_home_fragement, container, false);

        qrcode = view.findViewById(R.id.qrcode);
        qrcode.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(view.getContext(), PaymentCodeActivity.class);
                startActivity(intent);
            }
        });
        card_topup = view.findViewById(R.id.card_topup);
        card_topup.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(view.getContext(), CardTopUpActivity.class);
                startActivity(intent);
            }
        });
        balance = view.findViewById(R.id.balance);
        balance.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(view.getContext(), BalanceQueryActivity.class);
                startActivity(intent);
            }
        });

        qrcode_item = view.findViewById(R.id.qrcode_item);
        qrcode.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(view.getContext(), PaymentCodeActivity.class);
                startActivity(intent);
            }
        });
        school_introduction_item = view.findViewById(R.id.school_introduction_item);
        school_introduction_item.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(view.getContext(), SchoolIntroductionActivity.class);
                startActivity(intent);
            }
        });
        news_bulletin_item = view.findViewById(R.id.news_bulletin_item);
        news_bulletin_item.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(view.getContext(), NewsBulletinActivity.class);
                startActivity(intent);
            }
        });
        card_topup_item = view.findViewById(R.id.card_topup_item);
        card_topup_item.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(view.getContext(), CardTopUpActivity.class);
                startActivity(intent);
            }
        });
        trade_query_item = view.findViewById(R.id.trade_query_item);
        trade_query_item.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(view.getContext(), TradeQueryActivity.class);
                startActivity(intent);
            }
        });
        card_loss_item = view.findViewById(R.id.card_loss_item);
        card_loss_item.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(view.getContext(), CardLossActivity.class);
                startActivity(intent);
            }
        });
        card_unlock_item = view.findViewById(R.id.card_unlock_item);
        card_unlock_item.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(view.getContext(), CardUnlockActivity.class);
                startActivity(intent);
            }
        });
        return view;
    }
}
